<template>
  <div>
    <el-dialog
      ref="refDlg"
      title="编辑"
      :visible.sync="dialogShow"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :before-close="clearForm"
      width="600px"
      @close="closeDialog"
    >
      hh
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'EditItem',
  props: {
    visible: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      formData: {}
    }
  },
  computed: {
    dialogShow: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  methods: {
    closeDialog() {
      this.dialogShow = false
      this.clearForm()
    },

    clearForm(done) {
      this.formData = { }
      this.$refs.refForm && this.$refs.refForm.clearValidate()
      done && done()
    }
  }
}
</script>
